﻿using System;
using System.Collections.Generic;

using System.Text;

namespace SEO.Utility
{
    /// <summary>
    /// 版权所有: 版权所有(C) 2011，Adin Lee
    /// 内容摘要: 公用变量，通常用于整个项目或系统存储登陆用户的全局信息
    /// 完成日期：2011年4月14日
    /// 版    本：V1.0 
    /// 作    者：Adin
    /// </summary>
    public class PublicValue
    {
        //全局变量
        public static string m_strPublicValue;
        //全局消息
        public static string m_strMessage;
        //全局新闻抓取消息
        public static string m_strPublicNews;
        //全局关键词
        public static string m_strPublicKeywords;
        //全局关键词显示
        public static string m_strPublicViewKeywords;
        public static string m_strPostSuccess;
        public static string m_strPostFail;
        public static string m_strPostError;


        /// <summary>
        /// 存储发布错误消息
        /// </summary>
        /// <param name="strMsg">消息值</param>
        public static void SavePostError(string strMsg)
        {
            m_strPostError = strMsg + "\n" + m_strPostError;
        }

        /// <summary>
        /// 获取发布错误消息
        /// </summary>
        /// <returns>返回消息值</returns>
        public static string GetPostError()
        {
            return m_strPostError;
        }

        /// <summary>
        /// 存储发布失败消息
        /// </summary>
        /// <param name="strMsg">消息值</param>
        public static void SavePostFail(string strMsg)
        {
            m_strPostFail = strMsg + "\n" + m_strPostFail;
        }

        /// <summary>
        /// 获取发布失败消息
        /// </summary>
        /// <returns>返回消息值</returns>
        public static string GetPostFail()
        {
            return m_strPostFail;
        }

        /// <summary>
        /// 存储发布成功消息
        /// </summary>
        /// <param name="strMsg">消息值</param>
        public static void SavePostSuccess(string strMsg)
        {
            m_strPostSuccess = strMsg + "\n" + m_strPostSuccess;
        }

        /// <summary>
        /// 获取发布成功消息
        /// </summary>
        /// <returns>返回消息值</returns>
        public static string GetPostSuccess()
        {
            return m_strPostSuccess;
        }


        /// <summary>
        /// 存储全局变量值
        /// </summary>
        /// <param name="strValue">变量值</param>
        public static void SavePublicValue(string strValue)
        {
            m_strPublicValue = strValue;
        }

        /// <summary>
        /// 获取全局变量值
        /// </summary>
        /// <returns>返回全局变量值</returns>
        public static string GetPublicValue()
        {
            return m_strPublicValue;
        }

        /// <summary>
        /// 存储消息
        /// </summary>
        /// <param name="strMsg">消息值</param>
        public static void SaveMessage(string strMsg)
        {
            m_strMessage = strMsg + "\n" + m_strMessage;
        }

        /// <summary>
        /// 获取消息
        /// </summary>
        /// <returns>返回消息值</returns>
        public static string GetMessage()
        {
            return m_strMessage;
        }

        /// <summary>
        /// 存储抓取新闻全局变量值
        /// </summary>
        /// <param name="strMsg">信息</param>
        public static void SaveNewsValue(string strMsg)
        {
            m_strPublicNews = strMsg;
        }

        /// <summary>
        /// 获取抓取新闻全局变量值
        /// </summary>
        /// <returns>返回信息值</returns>
        public static string GetNewsValue()
        {
            return m_strPublicNews;
        }

        /// <summary>
        /// 保存销售管理系统管理员用户名
        /// </summary>
        /// <param name="strValue">用户名</param>
        public static void SaveAdminUserName(string strValue)
        {
            CommonHelper.SaveCookie("RunWo_NiuShi_AdminUserName", strValue, 1);
        }

        /// <summary>
        /// 获取销售管理系统管理员用户名
        /// </summary>
        /// <returns>返回销售管理系统管理员用户名</returns>
        public static string GetAdminUserName()
        {
            return CommonHelper.GetCookieString("RunWo_NiuShi_AdminUserName", true);
        }

        /// <summary>
        /// 保存销售管理系统管理员用户ID
        /// </summary>
        /// <param name="strValue">用户ID</param>
        public static void SaveAdminUserID(string strValue)
        {
            CommonHelper.SaveCookie("RunWo_NiuShi_AdminUserID", strValue, 1);
        }

        /// <summary>
        /// 获取销售管理系统管理员用户ID
        /// </summary>
        /// <returns>返回销售管理系统管理员用户ID</returns>
        public static string GetAdminUserID()
        {
            return CommonHelper.GetCookieString("RunWo_NiuShi_AdminUserID", true);
        }

        /// <summary>
        /// 保存销售管理系统管理员用户类型
        /// </summary>
        /// <param name="strValue">用户类型</param>
        public static void SaveAdminUserType(string strValue)
        {
            CommonHelper.SaveCookie("RunWo_NiuShi_AdminUserType", strValue, 1);
        }

        /// <summary>
        /// 获取销售管理系统管理员用户类型
        /// </summary>
        /// <returns>返回销售管理系统管理员用户类型</returns>
        public static string GetAdminUserType()
        {
            return CommonHelper.GetCookieString("RunWo_NiuShi_AdminUserType", true);
        }

        /// <summary>
        /// 保存销售管理系统管理员用户类型
        /// </summary>
        /// <param name="strValue">用户类型</param>
        public static void SaveAdminUserRealName(string strValue)
        {
            CommonHelper.SaveCookie("RunWo_NiuShi_AdminUserRealName", strValue, 1);
        }

        /// <summary>
        /// 获取销售管理系统管理员真实姓名
        /// </summary>
        /// <returns>返回销售管理系统管理员真实姓名</returns>
        public static string GetAdminUserRealName()
        {
            return CommonHelper.GetCookieString("RunWo_NiuShi_AdminUserRealName", true);
        }

        /// <summary>
        /// 存储关键词全局变量值
        /// </summary>
        /// <param name="strKeyword">关键词</param>
        public static void SaveKeywordsValue(string strKeyword)
        {
            m_strPublicKeywords = strKeyword;
        }

        /// <summary>
        /// 获取显示关键词全局变量值
        /// </summary>
        /// <returns>返回显示关键词全局变量值</returns>
        public static string GetKeywordsValue()
        {
            return m_strPublicKeywords;
        }

        /// <summary>
        /// 存储显示关键词全局变量值
        /// </summary>
        /// <param name="strKeyword">关键词</param>
        public static void SaveViewKeywordsValue(string strKeyword)
        {
            m_strPublicViewKeywords = strKeyword;
        }

        /// <summary>
        /// 获取关键词全局变量值
        /// </summary>
        /// <returns>返回关键词全局变量值</returns>
        public static string GetViewKeywordsValue()
        {
            return m_strPublicViewKeywords;
        }
    }
}
